package com.service.manage.imp;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.mapper.manage.AdminDao;
import com.po.Adminmain;
import com.service.manage.AdminService;
import com.util.MD5Util;

@Service
public class AdminServiceImp implements AdminService {

	@Resource(name="adminDao")
	public AdminDao adminDao;
	
	@Override
	public boolean getAdmin(Adminmain admin) {
		
		Adminmain radmin = adminDao.getAdmin(admin);
		if(radmin!=null){
			System.out.println(MD5Util.getMD5(admin.getAdminpwd()));
			if(radmin.getAdminpwd().equals(MD5Util.getMD5(admin.getAdminpwd()))){
				return true;
			}
		}
		return false;
	}
	
	@Override
	public List<Adminmain> getAdminList(Adminmain admin) {
		List<Adminmain> list = adminDao.getAdminList(admin);
		return list;
	}
	
	
	@Override
	public int getAdminCount(Adminmain admin) {
		
		return adminDao.getAdminCount(admin);
	}
	
	@Override
	public int addAdmin(Adminmain admin) {
		
		return adminDao.addAdmin(admin);
	}
	@Override
	public int updateAdmin(Adminmain admin) {
		
		return adminDao.updateAdmin(admin);
	}
	@Override
	public int delAdmin(Adminmain admin) {
	
		return adminDao.delAdmin(admin);
		
	}
	public int delAdminList(String[] admins){
	
		return adminDao.delAdminList(admins);
	}

	@Override
	public int updateAdminpwd(Adminmain admin) {
		
		return adminDao.updateAdminpwd(admin);
	}

}
